<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        价格:{{prices}}
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script>
        var app=new Vue({
            el:'#app',
            data:{
                packagel:[
                    {
                        name:'iPhine 7',
                        prices:7199,
                        count:2
                    },
                    {
                        name:'iPad',
                        prices:14,
                        count:1
                    }
                    ],
                    package2:[
                        {
                            name:'apple',
                            prices:3,
                            count:5
                        },
                        {
                            name:'banana',
                            prices:2,
                            count:10
                        }
                    ]
                },
                computed:{
                    prices:function(){
                        var prices=0;
                        for(var i=0;i<this.packagel.length;i++){
                            prices +=this.packagel[i].prices*this.packagel[i].count;
                        }
                        for(var i=0;i<this.package2.length;i++){
                            prices +=this.package2[i].prices*this.package2[i].count;
                        }
                        return prices;
                    }
                }
        })
    </script>
</body>
</html>